package coms.fourthirty.emm;

import coms.fourthirty.emm.resources.EMSResources;
import coms.fourthirty.emm.resources.WorkSession;

import java.util.ArrayList;

import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.LinearLayout;

public class EMSSchedule extends Activity {
	private String username;
	private ArrayList<WorkSession> schedule;

	@Override
	public void onCreate(Bundle grundle) {
		super.onCreate(grundle);
		setContentView(R.layout.schedule);

		schedule = EMSResources.schedule;

		LayoutInflater inflater = (LayoutInflater) getBaseContext()
				.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

		for (WorkSession ws : getCurrentSchedule()) {
			LinearLayout ll = (LinearLayout) inflater.inflate(
					R.layout.schedule_fields,
					(ViewGroup) findViewById(R.id.schedule_linear_layout));
			EditText et = ((EditText) ll.findViewById(R.id.datetimes_date)); 
			et.setText(ws.dateString());
			et.setId(0);	//don't want to find that view ever again
			et = ((EditText) ll.findViewById(R.id.datetimes_start)); 
			et.setText(ws.startString());
			et.setId(0);
			et = ((EditText) ll.findViewById(R.id.datetimes_stop)); 
			et.setText(ws.stopString());
			et.setId(0);
		}

	}
	
	public ArrayList<WorkSession> getCurrentSchedule()
	{
		return EMSResources.schedule;
	}
}
